<template>
	<view class="qxlj_back4 contain">
		<view class="park_item qxlj_back2" v-for="(item,index) in parkList" :key="index" @click="goDeatil(item.Id)">
			<view class="right">
				<image :src="item.ShopLogo" mode=""></image>
			</view>
			<view class="left">
				<view class="one">{{item.ShopName}}</view>
				<view class="two" v-if="item.BusinessHours">营业时间：{{item.BusinessHours}}</view>
				<view class="two" v-if="item.Mobile">联系电话：{{item.Mobile}}</view>
				<view class="three" v-if="item.Address">地址：{{item.Address}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getShopBgList
	} from '@/api/mall.js';
	export default {
		data() {
			return {
				parkList: '',
				travelinfo: '',
				shopType: 0,
			}
		},
		onLoad(options) {
			this.shopType = options.type;
			this.getShopBgList();
			uni.showShareMenu({
				withShareTicket: true,
				//设置下方的Menus菜单，才能够让发送给朋友与分享到朋友圈两个按钮可以点击
				menus: ["shareAppMessage", "shareTimeline"]
			})
		},
		onShareAppMessage(res) {
			if (res.from === 'button') { // 来自页面内分享按钮
				console.log(res.target)
			}
			return {
				title: this.$category.appName, //分享的名称
				path: '/pages/center/index?index=' + this.tabIdx,
				mpId: this.$category.appid //此处配置微信小程序的AppId
			}
		},
		methods: {
			//进入商家详情
			goDeatil(id) {
				// uni.navigateTo({
				// 	url: '/mall_subpages/shop/shopIndex?id=' + id
				// })
				uni.navigateTo({
					url: '/mall_subpages/shop/shopFoodslistDetail?id=' + id
				})
			},
			// 获取列表数据
			async getShopBgList() {
				let WhereParam = [{
						Name: 'IsBusiness',
						Type: 'EqualTo',
						Value: 1,
					},
					{
						Name: 'BusinessClassify',
						Type: 'EqualTo',
						Value: 3,
					}
				]
				if (this.shopType == 0) {
					WhereParam = [{
						Name: 'IsBusiness',
						Type: 'EqualTo',
						Value: 1,
					}]
				};
				try {
					const {
						Data
					} = await getShopBgList({
						AreaId: 0,
						ShopName: '',
						SpotGrade: 0,
						HotelStars: 0,
						Size: 100,
						WhereList: WhereParam,
						IsHot: 0,
					})
					let arr = [];
					Data.forEach(con => {
						if (con.IsBusiness == 1) {
							arr.push(con)
						}
					})
					this.parkList = arr;
					console.log('获取商家列表数据', Data)
				} catch {

				}
			},
		}
	}
</script>

<style scoped lang="scss">
	.contain {
		width: 100%;
		min-height: 100vh;
		padding: 4%;
		padding-top: 2%;
	}

	.park_item {
		width: 100%;
		height: 200rpx;
		border-radius: 2%;
		display: flex;
		justify-content: space-between;
		padding: 3% 2%;
		margin-top: 2%;

		.left {
			width: 65%;
			position: relative;

			.one {
				color: #1A1A1A;
				font-size: 30rpx;
				font-weight: bold;
			}

			.two {
				color: #999999;
				// height: 60rpx;
				margin-top: 2%;
				font-size: 24rpx;
			}

			.three {
				font-size: 24rpx;
				color: #999999;
				margin-top: 2%;
				white-space: nowrap;
				overflow: hidden;
				text-overflow: ellipsis;
			}

			.km_box {
				color: #498FFF;
				font-size: 20rpx;
				position: absolute;
				top: 1%;
				right: 0;
			}
		}

		.right {
			width: 30%;
			height: 100%;

			image {
				width: 100%;
				height: 100%;
				border-radius: 7px;
			}
		}

	}
</style>